package com.ybn.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ybn.entity.VoteItem;
import com.ybn.entity.VoteOption;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface VoteOptionMapper extends BaseMapper<VoteOption> {

    @Select(" SELECT * FROM vote_option WHERE VS_ID = #{vsid}")
    @Results(id = "option_Map",value = {
            @Result(property = "Void",column = "VO_ID"),
            @Result(property = "items",column = "VO_ID",many = @Many(select = "com.ybn.mapper.VoteItemMapper.findItemByVoId")),
    })
    public List<VoteOption> findOptionById(int vsid);


}
